<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../plugins/layui/css/layui.css" />
		<link href="../../kitAdmin/css/app.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" type="text/css" href="../../plugins/select2/dist/css/select2.min.css"/>
		<style type="text/css">
			.layui-unselect.layui-form-select {
			    display: none;
			}
		</style>
	</head>

	<body>
			<div style='margin:10px'>
				<label>分享地址：</label>
				<textarea rows="10" cols="35" id="shareUrl"></textarea>
				<button onclick="copyUrl()" type="button" class="layui-btn layui-btn-sm layui-btn" id="btn" value="" >点击复制地址</button>
				
			</div>
			
		<script src="../../common/js/jquery.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../static/js/base.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../plugins/jsviews/jsviews.js" type="text/javascript"></script>
		<script src="../../plugins/layui/layui.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../plugins/select2/dist/js/select2.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			$(document).ready(function(){
				// 2018-9-25 chenbin: 生成分享地址
				var adminUniqueId = "TEST[需要在登录页面写入Session]";
				$.ajax({
					url:baseUrl+ '/students/getUID',
					type: 'GET',
					async : false,
					success : function(data) {
						console.log("UID:",data);
						if (data != null && data !="" ) {
							adminUniqueId = data;	
						}
					}
				});
				var shareContent = "免费预约 https://www.ejoyenglish.org/Index/index/orderaudition.html?principal=" + adminUniqueId + " (出处: 美思)";
				$('#shareUrl').val(shareContent);
			});
			
			
			
		 	var btn = document.getElementById('btn');
		    btn.addEventListener('click', function(){
		        var inputText = document.getElementById('shareUrl');
		        var currentFocus = document.activeElement;
		        inputText.focus();
		        inputText.setSelectionRange(0, inputText.value.length);
		        document.execCommand('copy', true);
		        currentFocus.focus();
		    });
		    
		    // 2018-9-25 chenbin: 点击复制地址
		    function copyUrl() {
				 var Url=document.getElementById("shareUrl");
				 Url.select(); // 选择对象
				 document.execCommand("Copy"); // 执行浏览器复制命令
				 alert("已复制预约地址");
			}
		</script>
	</body>
</html>
